class Animal {
    action() {
        console.log('animal action');
    }
}

class Dog extends Animal {
    action() {
        console.log('dog running');
    }
}

class Person1 extends Animal {

}

// 多态的目的是为了写出更加具有通用性的代码
function makeActions(animals: Animal[]) {
    animals.forEach(animals => {
        animals.action()
    })
}

makeActions([new Dog(), new Animal()])